<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?>
<?php 
	$ci = & get_instance(); 
	$sportDataArray = $ci->sport_entity->getArrayIdAndNameOfSport();
	
?>
<?php if(!isset($id)): ?>
<form action="<?php echo site_url('admin/dataman/general/add_team_submit');?>" name="add_team_submit" id="add_team_submit" method="post" enctype="multipart/form-data" >
	
	<div class="grid2"><span class="bold">Team Name:</span></div>
	<div class="grid6"><input type="text" maxlength="255" id="name" name="name" value="" class="std-input"/></div>
	<div class="grid2"><span class="bold red hidden" id="name_error">Required field.</span></div>
	
	<div class="clrboth"></div>
	
	<div class="grid2"><span class="bold">Code:</span></div>
	<div class="grid6"><input type="text" maxlength="45" id="code" name="code" value="" class="std-input"/></div>
	<div class="grid2"><span class="bold red hidden" id="code_error">Required field.</span></div>
	
	<div class="clrboth"></div>
	
	<div class="grid2"><span class="bold">Feed Team ID:</span></div>
	<div class="grid6"><input type="text" maxlength="45" id="feed_team_id" name="feed_team_id" value="" class="std-input"/></div>
	<div class="grid2"><span class="bold red hidden" id="feed_team_id_error">Required field.</span></div>
	
<!--	<div class="clrboth"></div>
	<div class="grid2"><span class="bold">*Sport:</span></div>
	<div class="grid6"><?php /* echo form_dropdown( 'sport_id',
								$options = $sportDataArray,
								$selected = array(),
								"id='sport_id'"
							);*/	?></div>	-->
	<div class="clrboth"></div>
	
	<div class="grid2"><span class="bold">Flag:</span></div>
	<div class="grid4"><?php echo form_upload('flag');?></div>
	<div class="clrboth"></div>
	
	<div class="grid2">&nbsp;</div>
	<div class="grid6"><input type="submit" class="button" /> <?php echo loader_image('id="loader_image" class="hidden"');?></div>
	<div class="clrboth"></div>	
	
</form>
<?php else:?>
<form action="<?php echo site_url('admin/dataman/general/edit_team_submit');?>" name="edit_team_submit" id="edit_team_submit" method="post" enctype="multipart/form-data" >
	<?php 
		$TEAM = $ci->team_entity->init('id',$id);
	?>
	
	<div class="grid2"><span class="bold">*Name:</span></div>
	<div class="grid6"><input type="text" maxlength="255" id="name" name="name" value="<?php echo $TEAM->getName(); ?>" class="std-input"/></div>
	<div class="grid2"><span class="bold red hidden" id="name_error">Required field.</span></div>
	
	<div class="clrboth"></div>
	
	<div class="grid2"><span class="bold">Code:</span></div>
	<div class="grid6"><input type="text" maxlength="45" id="code" name="code" value="<?php echo $TEAM->getCode(); ?>" class="std-input"/></div>
	<div class="grid2"><span class="bold red hidden" id="code_error">Required field.</span></div>
	
	<div class="clrboth"></div>
	
	<div class="grid2"><span class="bold">Feed Team ID:</span></div>
	<div class="grid6"><input type="text" maxlength="45" id="feed_team_id" name="feed_team_id" value="<?php echo $TEAM->getFeedTeamId(); ?>" class="std-input"/></div>
	<div class="grid2"><span class="bold red hidden" id="feed_team_id_error">Required field.</span></div>
	
<!--	<div class="clrboth"></div>
	<div class="grid2"><span class="bold">*Sport:</span></div>
	<div class="grid6"><?php /* echo form_dropdown( 'sport_id',
								$options = $sportDataArray,
								$selected = array($TEAM->getSportId()),
								"id='sport_id'"
							);*/	?></div>	-->
	<div class="clrboth"></div>
	
	<div class="grid2"><span class="bold">Flag:</span></div>
	<div class="grid4"><?php echo form_upload('flag');?></div>
	<div class="grid2"><?php echo thumb($TEAM->getMyFlagTeam(),60,60);?></div>
	<div class="clrboth"></div>
	
	<input type="hidden" name="id" id="id" value="<?php echo $TEAM->getId();?>" />
	<div class="grid2">&nbsp;</div>
	<div class="grid6"><input type="submit" class="button" /> <?php echo loader_image('id="loader_image" class="hidden"');?></div>
	<div class="clrboth"></div>	
	
</form>
<?php endif;?>